package com.crape.common.enums;

public enum MessageType {

	other(0), send(1), receive(2);

	private int code;

	MessageType(int code) {
		this.code = code;
	}

	public int getCode() {
		return code;
	}

	public static MessageType valueOf(int code) {
		for (MessageType type : values()) {
			if (type.getCode() == code) {
				return type;
			}
		}
		throw new IllegalArgumentException("Invalid type [" + code + "]");
	}
}
